#include "circle_union.h"

namespace Packing_common
{
	void Circle_union::gl_draw(const GLfloat* fill_color) const
	{
		// for debug
		//glPointSize(4.0f);
		//glColor3f(0.0f, 0.0f, 0.0f);
		//glBegin(GL_POINTS);
		//glVertex2d(cent.x(), cent.y());
		//glEnd();
		std::for_each(circles.begin(), circles.end(), std::bind2nd(std::mem_fun_ref(&Particle_circle::gl_draw), fill_color));
	}

	void Circle_union::transform(double theta, double tx, double ty)
	{
		//typedef CGAL::Aff_transformation_2< CGAL::Exact_predicates_inexact_constructions_kernel > Transformation_2;
		//double fsin = std::sin(theta), fcos = std::cos(theta);
		//Transformation_2 t(fcos, -fsin, tx, fsin, fcos, ty);
		for (unsigned int i = 0; i < circles.size(); i++)
			circles[i] = centralized_transform(circles[i], theta, tx, ty);
		double fs = std::sin(theta), fc = std::cos(theta);
		Point_2::Aff_transformation_2 t(fc, -fs, tx, fs, fc, ty);
		//cent = t(cent);
	}
}